package com.evildog.workspace.generator.runner;


import com.evildog.workspace.generator.gene.CloudGenerator;

public class CloudCodeGeneratorRunner {

    public static void main(String[] args) {
//        run();
//        partRun();
        oneTableRun();
    }


    /**
     * 生成所有表
     * module不一样的话，建议使用 partRun
     */
    public static void run() {
        CloudGenerator cloudGenerator = new CloudGenerator();
        cloudGenerator.run(true);
    }

    private static void oneTableRun() {
        CloudGenerator cloudGenerator = new CloudGenerator();
        cloudGenerator.setPackageDir("D://mycode11");

//        cloudGenerator.setServiceName("workspace-system");
//        cloudGenerator.setModuleName("system");
//        cloudGenerator.setHasSuper(true);
//
//        cloudGenerator.setUrl("jdbc:mysql://localhost:3306/ws_system?useSSL=false&useUnicode=true&characterEncoding=utf-8&serverTimezone=GMT%2B8");
//        cloudGenerator.setIncludeTables(new String[]{
//                "sys_exception_log",
//        });

        cloudGenerator.setServiceName("workspace-log");
        cloudGenerator.setModuleName("log");

        cloudGenerator.setUrl("jdbc:mysql://localhost:3306/ws_log?useSSL=false&useUnicode=true&characterEncoding=utf-8&serverTimezone=GMT%2B8");
//        cloudGenerator.setIncludeTables(new String[]{
//                "sys_exception_log",
//        });

//        cloudGenerator = new CloudGenerator();
//        cloudGenerator.setServiceName("workspace-life");
//        cloudGenerator.setModuleName("life");
//        cloudGenerator.setUrl("jdbc:mysql://localhost:3306/ws_life?useSSL=false&useUnicode=true&characterEncoding=utf-8&serverTimezone=GMT%2B8");
//        cloudGenerator.setIncludeTables(new String[]{
//                "life_micro_habit",
//        });

        cloudGenerator.run(true);
    }

    /**
     * 生成指定表
     */
    public static void partRun() {
        try{
            CloudGenerator cloudGenerator = new CloudGenerator();
            cloudGenerator.setPackageDir("D://mycode7");

            cloudGenerator.setUsername("root");
            cloudGenerator.setPassword("root");

            cloudGenerator.setServiceName("workspace-invest");
            cloudGenerator.setModuleName("invest");
            cloudGenerator.setUrl("jdbc:mysql://localhost:3306/ws_invest?useSSL=false&useUnicode=true&characterEncoding=utf-8&serverTimezone=GMT%2B8");
            cloudGenerator.run(false);

            cloudGenerator = new CloudGenerator();
            cloudGenerator.setPackageDir("D://mycode7");
            cloudGenerator.setServiceName("workspace-system");
            cloudGenerator.setModuleName("system");
            cloudGenerator.setUrl("jdbc:mysql://localhost:3306/ws_system?useSSL=false&useUnicode=true&characterEncoding=utf-8&serverTimezone=GMT%2B8");
            cloudGenerator.run(false);


            cloudGenerator = new CloudGenerator();
            cloudGenerator.setPackageDir("D://mycode7");
            cloudGenerator.setServiceName("workspace-life");
            cloudGenerator.setUrl("jdbc:mysql://localhost:3306/ws_life?useSSL=false&useUnicode=true&characterEncoding=utf-8&serverTimezone=GMT%2B8");
            cloudGenerator.setModuleName("life");

            cloudGenerator.run(true);
        }catch (Exception e){

        }
    }




}
